package com.nuyoah.service.impl;

import com.nuyoah.common.dto.RoleDto;
import com.nuyoah.entity.Role;
import com.nuyoah.mapper.RoleMapper;
import com.nuyoah.service.RoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 存储系统中的角色信息 服务实现类
 * </p>
 *
 * @author xyx
 * @since 2024-06-03
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {


    @Override
    public String getRoleNameByUserId(Integer id) {
        //先根据id到user_role表中查询role_id
        Integer roleId = baseMapper.getRoleByUserId(id);
        //再根据role_id到role表中查询name
        return baseMapper.getRoleNameById(roleId);
    }
}
